﻿using CarEdge.Infrastructure.Dto.Request.Customer;
using CarEdge.Infrastructure.IOC;
using CarEdge.Infrastructure.IOC.Customer;
using CarEdge.Service.Interface;
using CarEdge.Service.Interface.Count;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace CarEdge.Admin.Controllers.count
{


    /// <summary>
    /// 统计管理
    /// </summary>
    /// 
    [Authorize(Roles = "Admin")]
    public class CountController : BaseController
    {
        private readonly I_Count_Service _Count_Service;


        /// <summary>
        /// 
        /// </summary>
        /// <param name="login_Service"></param>
        /// <param name="Count_Service"></param>

        public CountController(I_Login_Service login_Service, I_Count_Service Count_Service) : base(login_Service)
        {
            _Count_Service = Count_Service;
        }


        /// <summary>
        /// 获取成功率最高的三名客户
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> GetcustomerCount()
        {
            var result = await _Count_Service.GetcustomerCount();
            return Ok(result);

        }
        /// <summary>
        /// 获取最近一周的会员增长数量
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> GetWeekVipCount()
        {
            var result = await _Count_Service.GetWeekVipCount();
            return Ok(result);
        }
        /// <summary>
        /// 获取最近一周的客户增长数量
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetWeekCustomerCount()
        {
            var result = await _Count_Service.GetWeekCustomerCount();
            return Ok(result);
        }


        /// <summary>
        /// 获取各等级会员的总人数
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> GetTypeVipCount()
        {
            var result = await _Count_Service.GetTypeVipCount();
            return Ok(result);
        }
        /// <summary>
        /// 获取套餐的销量
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> GetPackCount()
        {
            var result = await _Count_Service.GetPackCount();
            return Ok(result);
        }
        /// <summary>
        /// 获取最近三名新增加的会员
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> RecentVip()
        {
            var result = await _Count_Service.RecentVip();
            return Ok(result);
        }
        /// <summary>
        /// 今日销售额度
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> TodayPrice()
        {
            var result = await _Count_Service.TodayPrice();
            return Ok(result);
        }
        /// <summary>
        /// 总销售额度
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> TotalPrice()
        {
            var result = await _Count_Service.TotalPrice();
            return Ok(result);
        }

        /// <summary>
        /// 会员总人数
        /// </summary>
        /// <returns></returns>

        [HttpGet]

        public async Task<IActionResult> VipTotal()
        {
            var result = await _Count_Service.VipTotal();
            return Ok(result);
        }
        /// <summary>
        /// 今天新增会员人数
        /// </summary>
        /// <returns></returns>
        [HttpGet]

        public async Task<IActionResult> TodayVipCount()
        {
            var result = await _Count_Service.TodayVipCount();
            return Ok(result);
        
        
        }
        /// <summary>
        /// 客户总数
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet]
        public async Task<IActionResult> CusTotal()
        {
            var result=await _Count_Service.CusTotal();
            return Ok(result);
        }
        /// <summary>
        /// 今日新增客户数量
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> TodayCusTotal()
        {
            var result=await _Count_Service.TodayCusTotal();
            return Ok(result);
        }
        /// <summary>
        /// 客户平均跟进进度
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> AvgCusRecord()
        {
            var result= await _Count_Service.AvgCusRecord();
            return Ok(result);
        }
        /// <summary>
        /// 客户来源
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetSourceCount()
        {
            var result = await _Count_Service.GetSourceCount();
            return Ok(result);
        }
        /// <summary>
        /// 客户成功率由低到高
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetCusSuccessCount()
        {
            var result = await _Count_Service.GetCusSuccessCount();
            return Ok(result);
        }
        /// <summary>
        /// 获取类型数量
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetTypeCount()
        {
            var result = await _Count_Service.GetTypeCount();
            return Ok(result);

        }
        /// <summary>
        /// 服务销量
        /// </summary>
        /// <returns></returns>

        [HttpGet]
        public async Task<IActionResult> GetFwSales()
        {
            var result = await _Count_Service.GetFwSales();
            return Ok(result);

        }
        /// <summary>
        /// 实物销量
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetSwSales()
        {
            var result = await _Count_Service.GetSwSales();
            return Ok(result);

        }
        /// <summary>
        /// 每月销量
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> MonthsSales()
        {
            var result = await _Count_Service.MonthsSales();
            return Ok(result);

        }


    }
}
